package org.droid.cmplatform.core.application;

import org.droid.cmplatform.core.constant.Constant;
import org.droid.cmplatform.core.task.TaskMain;

import android.app.Application;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;

public class CMApplication extends Application implements Constant {
    private static final String TAG = "CMApplication";

    TaskMain mTaskEngine = null;

    @Override
    public void onCreate() {
        super.onCreate();

        init();
    }

    private boolean init() {
        mTaskEngine = TaskMain.getTaskEngine();

        return false;
    }

    /**
     * 
     * @return
     */
    public SharedPreferences getSettingSharedPreferences() {
        return getSharedPreferences(Settings_Preferences.SETTING_NAME.getName(), MODE_PRIVATE);
    }

    /**
     * 从AndroidManifest.xml文件中获取设置信息
     */
    private void initSettings() {
        ApplicationInfo aplctInfo = null;
        try {
            aplctInfo = getPackageManager().getApplicationInfo(getPackageName(),
                                                               PackageManager.GET_META_DATA);
            Bundle metaBundle = aplctInfo.metaData;

        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}
